#!/usr/bin/env python
    ##########################################################################
    ##(c) 2008 Bastian Damman                                               ##
    ##                                                                      ##
    ##This file is part of Kaboom-O-rama.                                   ##
    ##                                                                      ##
    ##Kaboom-O-rama is free software: you can redistribute it and/or modify ##
    ##it under the terms of the GNU General Public License as published by  ##
    ##the Free Software Foundation, either version 3 of the License, or     ##
    ##(at your option) any later version.                                   ##
    ##                                                                      ##
    ##Kaboom-O-rama is distributed in the hope that it will be useful,      ##
    ##but WITHOUT ANY WARRANTY; without even the implied warranty of        ##
    ##MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         ##
    ##GNU General Public License for more details.                          ##
    ##                                                                      ##
    ##You should have received a copy of the GNU General Public License     ##
    ##along with Kaboom-O-rama.  If not, see <http://www.gnu.org/licenses/>.##
    ##########################################################################
import sys, pygame
from pygame import *
from Engine.Main import Main
from Engine.Const import FPS
import psyco

class StartUp:
    def Loop(self):
        clock = time.Clock() #create counter
        main = Main()
        gemFps = float(0)
        frame = 0
        
        while 1:
            frame += 1
            end = main.update(clock.get_fps()) #update game return if quit
            main.draw() #draw game
            gemFps = float(frame-1)/float(frame)*gemFps + 1/float(frame) * clock.get_fps()
            if (end):
                break           
            clock.tick(FPS) #wait
        print "Gemiddelde FPS: " + str(gemFps)
        print "Frames: " + str(frame)
        
        exit()
        
if __name__ == "__main__":
    psyco.log()
    psyco.full()
    startup = StartUp()
    startup.Loop() #start looping
